--- id: TASK-030 title: 'TUI: Preserve panel scroll position across data refreshes' status: To Do assignee: [] created_date: '2026-06-12 04:21' labels: - tui - enhancement dependencies: [] priority: medium ordinal: 30000 --- ## Description Every time `refresh_data()` runs, all `DashPanel` content is replaced via `set_content()`, which resets the scroll position to the top. If a user has scrolled halfway through a news feed, a background refresh jumps them back to the top. Implementation: - Before `set_content()`, save `panel.scroll_y` (or `panel.scroll_offset`) - After `set_content()` (which replaces the `Static`), restore the saved scroll position via `panel.scroll_to(y=saved_y, animate=False)` - Only restore if the new content height ≥ saved scroll position (avoid restoring to a position that no longer exists after content shrinks) - Apply to all `DashPanel` instances ## Acceptance Criteria - [ ] #1 Scroll position is maintained across automatic background refreshes - [ ] #2 Manual r refresh also preserves scroll - [ ] #3 Scroll resets to top when the panel's source kind changes or content is significantly shorter - [ ] #4 No visible scroll jump during updates